<?php
if (false)$category_cover = new ORM_Category_Data_Cover();
?>
<table class="mainTable">
    <tr>
        <th colspan="2">封面设置</th>
    </tr>
    <tr>
        <td class="td1" align="right" width="20%">是否启用封面：</td>
        <td>
        <label><?php echo Form::radio('data[cover][use]',1,$category_cover->use===1?true:false,array('id'=>'cover_use_1','onclick'=>'use_cover()'));?>使用</label>
        <label><?php echo Form::radio('data[cover][use]',0,$category_cover->use===1?false:true,array('id'=>'cover_use_0','onclick'=>'use_cover()'));?>不使用</label>
    </td>
    </tr>
    <tbody id="cover_div">
    <tr>
        <td width="100" class="td1" align="right">选择封面模板：</td>
        <td>
        <?php echo Form::select('data[cover][tpl]',array('default'=>'默认'),$category_cover->tpl);?>
        </td>
    </tr>
    <tr>
        <td class="td1" align="right">输出方式：</td>
        <td>
        <label><?php echo Form::radio('data[cover][tohtml]',1,$category_cover->tohtml===1?true:false,array('id'=>'show_cover_1','onclick'=>'show_cover_output()'));?>生成静态封面页</label>
        <label><?php echo Form::radio('data[cover][tohtml]',0,$category_cover->tohtml===1?false:true,array('id'=>'show_cover_2','onclick'=>'show_cover_output()'));?>使用动态封面页</label>
        </td>
    </tr>
    <tr>
        <td class="td1" align="right">页面输出选项：</td>
        <td>
            <table class="mainTable" style="width:auto" id="cover_output_div_1">
                <tr>
                    <td class="td1" align="right">封面文件名：</td>
                    <td>
                    <?php
                    $suffix = (array)Core::config('category/cover.allow_suffix');
                    echo Form::input('data[cover][filename]',$category_cover->filename?$category_cover->filename:'index.html',array('title'=>'例如：index.html<br>后缀只允许:'.implode(',', $suffix)));?>
                    </td>
                </tr>
                <tr>
                    <td class="td1" align="right">URL隐藏文件名：</td>
                    <td>
                    <label><?php echo Form::radio('data[cover][hidden_filename]',1,$category_cover->hidden_filename===0?false:true);?>是</label>
                    <label><?php echo Form::radio('data[cover][hidden_filename]',0,$category_cover->hidden_filename===0?true:false);?>否</label>
                    <span class="helpicon" title="不隐藏：http://test.com/myclass/index.html<br/>隐藏后：http://test.com/myclass/">&nbsp;</span>
                    </td>
                </tr>
            </table>
            <table class="mainTable" style="width:auto" id="cover_output_div_2">
                <tr>
                    <td class="td1" align="right">缓存时间：</td>
                    <td>
                    <?php echo Form::input('data[cover][cache_time]',$category_cover->cache_time?$category_cover->cache_time:'0',array('size'=>4,'title'=>'单位：秒，0表示不缓存'));?>
                    </td>
                </tr>
            </table>
            <script type="text/javascript">
            function show_cover_output()
            {
                var obj1 = MyQEE.$('cover_output_div_1');
                var obj2 = MyQEE.$('cover_output_div_2');
                if (MyQEE.$('show_cover_1').checked)
                {
                    obj1.style.display = '';
                    obj2.style.display = 'none';
                }
                else
                {
                    obj1.style.display = 'none';
                    obj2.style.display = '';
                }
            }
            show_cover_output();
            </script>
        </td>
    </tr>
    <?php
    foreach ( View::get_tag('cms.admin.category.form.cover') as $item )
    {
    ?>
    <tr>
        <td class="td1" align="right"><?php $item->run(0);?></td>
        <td>
            <?php $item->run(1);?>
        </td>
    </tr>
    <?php
    }
    ?>
    </tbody>
</table>
<script type="text/javascript">
function use_cover()
{
    if ( MyQEE.$('cover_use_0').checked )
    {
        MyQEE.$('cover_div').style.display = 'none';
    }
    else
    {
        MyQEE.$('cover_div').style.display = '';
    }
}
use_cover();
</script>